<template>
	<view class="detail_index">
		<ABanner :isSeach="false"></ABanner>
		<view class="pic_coat">
			<image :src="params.realProductImgUrl" mode="widthFix"></image>
		</view>
		<AShopCar :params="params" :buy="true" />
		<view class="shop_info">
			<view class="price">
				￥{{params.price}}
			</view>
			<!-- <view class="info">
				苏菲卫生巾 超熟睡420柔棉感量多夜用纤巧棉柔 4片/包
			</view> -->
			<view class="sellNum">
				库存{{params.extantQuantity}}
			</view>
		</view>
		<view class="shop_info">
			<view class="title">
				商品详情
			</view>
			<view class="shop_infodesc">
				<view class="shop_item">
					<view class="square_num">
						商品名称
					</view>
					<view class="square_content">
						{{params.productName}}
					</view>
				</view>
				<view class="shop_item">
					<view class="square_num">
						库存
					</view>
					<view class="square_content">
						{{params.extantQuantity}}
					</view>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	import {
		getShop
	} from '@/api/index.js'
	export default {
		data() {
			return {
				itemData: {},
				params: {},
			}
		},
		methods: {
			getNum(num) {
				console.log(num);
			}
		},
		onLoad(options) {
			let decodeURIComponentStr = decodeURIComponent(options.item);
			this.itemData = JSON.parse(decodeURIComponentStr);
			getShop(this.itemData).then(res => {
				this.params = res.data
			})
		},
		onShow() {}
	}
</script>

<style lang="scss" scoped>
	.detail_index {
		width: 100%;
		height: 100%;

		.pic_coat {
			background-color: #fff;
			padding: 50rpx;
			display: flex;
			justify-content: center;
			align-items: center;
			margin-top: -70rpx;

			image {
				width: 300rpx;
			}
		}

		.shop_info {
			width: 90%;
			background-color: #fff;
			margin: 20rpx auto;
			padding: 20rpx;
			border-radius: 20rpx;


			.price {
				color: #F86853;
				font-size: 36rpx;
				margin: 20rpx 0;
			}

			.info {

				font-size: 30rpx;
				letter-spacing: 0.2rem;
				line-height: 1.8rem;
				margin: 20rpx 0;
			}

			.sellNum {
				color: #b5b5b5;
				font-size: 20rpx;
			}

			.title {
				font-size: 36rpx;
				margin: 20rpx 0 30rpx 0;
			}

			.shop_infodesc {
				background-color: #fafafa;
				width: 95%;
				padding: 20rpx;
				border-radius: 20rpx;
				margin: 0 auto;

				.shop_item {
					display: flex;
					justify-content: flex-start;
					align-items: center;
					margin: 20rpx 0;

					.square_num {
						width: 40%;
						color: #cbcbcb;
					}
				}

			}


		}
	}
</style>